#include<bits/stdc++.h>
#include<conio.h>
#include<Windows.h>
using namespace std;
#define press system("pause")
const int N = 1002;
const int Home = 1400;
const int Grass = 1400;
const int Hole = 1400;
const int Mine = 1400;
const int Temple = 5;
int hungry = 0, thirsty = 0, tired = 0, fire = 100;
char mp[N][N];
bool vis[N][N];
int fire_lx = 1, gj = 1, high_herb = 0, low_hp = 0, kill = 0, quick_move = 0;
int max_hp = 25;
int bread = 2, berry = 0, stone = 0, wood = 0, iron = 0, water = 2, hp = 25, herb = 0;
int bleed = 0, leather = 0;
int level[100];
int lh = 0;
bool check(int x, int y) {
	if (mp[x][y] == 'T' || mp[x][y] == 'O' || mp[x][y] == 'H' || mp[x][y] == 'K' || mp[x][y] == 'G' || x < 4 || x > 1000 || y < 4 || y > 1000) return 1;
	else return 0;
}
void init_map() {
	for (int i = 1; i <= Home; i++) {
		int x = rand() % N + 1;
		int y = rand() % N + 1;
		if (check(x, y)) continue;
		mp[x][y] = 'H';
		for (int p = max(x - 3, 1); p <= min(x + 3, N); p++) {
			for (int q = max(y - 3, 1); q <= min(y + 3, N); q++) {
				if (check(p, q) || abs(p - x) + abs(q - y) > 3) continue;
				mp[p][q] = 'L';
			}
		}
	}
	for (int i = 1; i <= Home; i++) {
		int x = rand() % N + 1;
		int y = rand() % N + 1;
		if (check(x, y)) continue;
		mp[x][y] = 'T';
		for (int p = max(x - 10, 1); p <= min(x + 10, N); p++) {
			for (int q = max(y - 10, 1); q <= min(y + 10, N); q++) {
				if (check(p, q) || abs(p - x) + abs(q - y) > 10) continue;
				mp[p][q] = '@';
			}
		}
	}
	for (int i = 1; i <= Hole; i++) {
		int x = rand() % N + 1;
		int y = rand() % N + 1;
		if (check(x, y)) continue;
		mp[x][y] = 'O';
	}
	for (int i = 1; i <= Mine; i++) {
		int x = rand() % N + 1;
		int y = rand() % N + 1;
		if (check(x, y)) continue;
		mp[x][y] = 'K';
	}
	for (int i = 1; i <= Grass; i++) {
		int x = rand() % N + 1;
		int y = rand() % N + 1;
		if (check(x, y)) continue;
		mp[x][y] = 'G';
	}
}
void put(int x, int y) {
	int fx = 0;
	if (fire == 0) fx = 1;
	if (fire) {
		if (fire_lx == 1) fx = 3;
		if (fire_lx == 2) fx = 4;
		if (fire_lx == 3) fx = 5;
	}
	char out[36][36];
	for (int i = 1; i <= 12; i++) {
		for (int j = 1; j <= 12; j++) {
			out[i][j] = ' ';
		}
	}
	int ox = 1, oy = 1;
	for (int p = max(x - 5, 1); p <= min(x + 5, N); p++) {
		ox++;
		for (int q = max(y - 5, 1); q <= min(y + 5, N); q++) {
			oy++;
			if (abs(p - x) + abs(q - y) > fx) continue;
			out[ox][oy] = mp[p][q];
		}
		oy = 1;
	}
	out[7][7] = 'Y';
	cout << "x:" << y << " y:" << x << " Fire:" << fire << "/100 Hungry:" << hungry << "/100" << " Thirsty:" << thirsty << "/150" << " tired:" << tired << "/200" << " hp:" << hp << "/" << max_hp << endl;
	for (int i = 1; i <= 12; i++) {
		for (int j = 1; j <= 12; j++) {
			cout << out[i][j];
		}
		cout << endl;
	}
	cout << "浆果:" << berry << ' ' << "面包：" << bread << ' ' << "水：" << water << " 草药：" << herb << '\n' << "木头：" << wood << ' ' << "石头：" << stone << ' ' << "铁：" << iron << "血石：" << bleed << "皮革：" << leather << endl;
	if (gj == 3) cout << "木剑，";
	if (gj == 5) cout << "石剑，";
	if (gj == 7) cout << "铁剑，";
	if (gj > 7) cout << "血石剑，";
	if (gj == 1) cout << "赤手空拳，";
	if (fire_lx == 1) cout << "火把，";
	if (fire_lx == 2) cout << "燃油灯，";
	if (fire_lx == 3) cout << "强光手电筒，";
	if (low_hp == 0) cout << "普通布衣，";
	if (low_hp == 2) cout << "木甲，";
	if (low_hp == 5) cout << "铁甲，";
	cout << "秒人斧" << kill << "个，强力回复药水" << high_herb << "瓶，传送卷轴" << quick_move << "卷，血石项链" << (max_hp - 25) / 3 << "个。\n";
}
void animal() {
	cout << "你遇到了一只野兽！";
	int x = rand() % 4 + 1 + lh * 5, y = rand() % 40 + 10 + lh * 15;
	cout << "它的伤害是" << x << "点，生命是" << y << "点。\n";
	press;
	while (1) {
		if (y <= 0) {
			int ble = 0, lea = 0;
			cout << "野兽倒下了。。。你从它的身上搜到了" << ble << "个血石，" << lea << "片皮革。\n";
			bleed += ble;
			leather += lea;
			return ;
		}
		if (hp <= 0) {
			cout << "你倒下了。。。\n";
			exit(0);
		}
		cout << "你选择：1.攻击它；2.驱赶（30%成功）3.秒了；\n";
		cout << "你的血量：" << hp << ' ' << "它的血量：" << y << endl;
		char op = getch();
		if (op == '1') {
			int fg1 = rand() % 3, fg2 = rand() % 3;
			cout << "你造成了" << max(gj - fg1, 0) << "点伤害。\n";
			press;
			y -= max(gj - fg1, 0);
			cout << "它对你造成了" << max(x - fg2 - low_hp, 0) << "点伤害。\n";
			press;
			hp -= max(x - fg2 - low_hp, 0);
			system("cls");
		} else if (op == '2') {
			int fg = rand() % 10;
			if (fg < 3) {
				cout << "驱赶成功！\n";
				press;
				system("cls");
				return ;
			} else {
				int fg2 = rand() % 3;
				cout << "它对你造成了" << max(x - fg2 - low_hp, 0) << "点伤害。\n";
				press;
				hp -= max(x - fg2 - low_hp, 0);
				system("cls");
			}
		} else if (op == '3') {
			if (kill) {
				kill--;
				y = -0x3f3f3f3f;
			} else {
				cout << "你没有秒人斧了。\n";
			}
		} else if (op == 'c') {
			if (herb) {
				herb--;
				hp += 3;
				hp = min(hp, max_hp);
			} else {
				cout << "你没有足够多草药。\n";
				press;
			}
		} else if (op == 'x') {
			if (high_herb) {
				high_herb--;
				hp = max_hp;
			} else cout << "你没有足够的强力生命药水。\n";
		}
		system("cls");
	}
}
void robber() {
	cout << "你遇到了一名强盗！";
	int x = rand() % 5 + 5 + lh * 5, y = rand() % 10 + 5 + lh * 15;
	cout << "他的伤害是" << x << "点，生命是" << y << "点。\n";
	press;
	while (1) {
		if (y <= 0) {
			int iro = rand() % 6;
			cout << "强盗倒下了。。。你从他的身上搜到了" << iro << "块铁锭。\n";
			iron += iro;
			return ;
		}
		if (hp <= 0) {
			cout << "你倒下了。。。\n";
			exit(0);
		}
		cout << "你选择：1.攻击它；2.驱赶（需要缴纳 5 块铁锭）3.秒了\n";
		cout << "你的血量：" << hp << ' ' << "它的血量：" << y << endl;
		char op = getch();
		if (op == '1') {
			int fg1 = rand() % 3, fg2 = rand() % 3;
			cout << "你造成了" << max(gj - fg1, 0) << "点伤害。\n";
			press;
			y -= max(gj - fg1, 0);
			cout << "它对你造成了" << max(x - fg2 - low_hp, 0) << "点伤害。\n";
			press;
			hp -= max(x - fg2 - low_hp, 0);
			system("cls");
		} else if (op == '2') {
			if (iron >= 5) {
				cout << "驱赶成功！\n";
				iron -= 5;
				press;
				system("cls");
				return ;
			}
		} else if (op == '3') {
			if (kill) {
				kill--;
				y = -0x3f3f3f3f;
			} else {
				cout << "你没有足够多的秒人斧。\n";
			}
		} else if (op == 'c') {
			if (herb) {
				herb--;
				hp += 3;
				hp = min(hp, max_hp);
			} else {
				cout << "你没有足够多草药。\n";
				press;
			}
		} else if (op == 'x') {
			if (high_herb) {
				high_herb--;
				hp = max_hp;
			} else cout << "你没有足够的强力生命药水。\n";
		}
		system("cls");
	}
	
}
void home(int x, int y) {
	system("cls");
	while (1) {
		printf("你进入了一间屋子，你可以：\n1.为你的照明工具添加燃料\n2.充满你的饱食度\n3.喝下足够的水\n4.睡一觉\n5.房子里散落了一些神秘材料，你可以去看一看\n6.退出\n");
		char op1 = getch();
		if (op1 == '1') fire = 100;
		if (op1 == '2') hungry = 0;
		if (op1 == '3') thirsty = 0;
		if (op1 == '4') tired = 0;
		if (op1 == '5') {
			if (vis[x][y]) {
				cout << "房子家徒四壁。\n";
				press;
			} else {
				int sto = rand() % 5;
				int ber = rand() % 5;
				int bre = rand() % 2;
				int woo = rand() % 5;
				int iro = rand() % 2;
				int wat = rand() % 5;
				cout << "你获得了：" << ber << "个浆果," << bre << "个面包," << wat << "瓶水," << woo << "根木头," << sto << "块石头," << iro << "块铁\n。";
				press;
				vis[x][y] = 1;
				berry += ber;
				bread += bre;
				wood += woo;
				stone += sto;
				iron += iro;
				water += wat;
			}
		}
		if (op1 == '6') break;
		system("cls");
	}
}
void grass(int x, int y) {
	if (vis[x][y]) {
		cout << "草丛里什么也没有。\n";
		press;
	} else {
		system("cls");
		vis[x][y] = 1;
		int p = rand() % 5;
		if (p <= 1) {
			animal();
		}
		int her = rand() % 5 + 1, ber = rand() % 5, woo = rand() % 5;
		cout << "你获得了：" << her << "个草药，" << woo << "块木头，" << ber << "个浆果。\n";
		herb += her;
		berry += ber;
		wood += woo;
		press;
		system("cls");
	}
}
void hole(int x, int y) {
	if (vis[x][y]) {
		cout << "洞穴里什么也没有。\n";
		press;
	} else {
		system("cls");
		vis[x][y] = 1;
		animal();
		int wat = rand() % 5 + 1, sto = rand() % 5;
		cout << "你获得了：" << wat << "瓶水，" << sto << "块石头。\n";
		water += wat;
		stone += sto;
		press;
		system("cls");
	}
}
void mine(int x, int y) {
	if (vis[x][y]) {
		cout << "矿洞里什么也没有。\n";
		press;
	} else {
		system("cls");
		vis[x][y] = 1;
		robber();
		int iro = rand() % 7, sto = rand() % 7;
		cout << "你获得了：" << iro << "块铁，" << sto << "块石头。\n";
		iron += iro;
		stone += sto;
		press;
		system("cls");
	}
}
void made() {
	system("cls");
	cout << "1.油灯，需要5个木头，5个石头，增加光照强度到4\n";
	cout << "2.强光手电筒，需要15个铁，增加光照强度到5\n";
	cout << "3.木剑，需要5个木头，1个石头，增加你的伤害到3\n";
	cout << "4.石剑，需要5个石头，1个木头，增加你的伤害到5\n";
	cout << "5.铁剑，需要5个铁锭，2个石头，2个木头，增加你的伤害到7\n";
	cout << "6.强力恢复药水，需要5个浆果，5个草药，回复生命到满血\n";
	cout << "7.木质盔甲，需要10个木头，减免2的伤害\n";
	cout << "8.铁质盔甲，需要10个铁锭，减免5的伤害\n";
	cout << "9.秒人斧，需要70个铁锭，20个石头，20个木头，秒杀一个敌人\n";
	cout << "0.传送图腾，需要20个铁锭，20个木头，20个石头，可以去挑战Boss-1：九头蛇\n";
	cout << "o.燃料，1个木头可以制作20个，用于火把的燃料\n";
	cout << "p.草药，两个浆果，用于回复自身的生命\n";
	cout << "l.血石项链，5个血石，3个皮革，增加自己3点生命上限\n";
	cout << "m.血石剑，5个血石，一把铁剑，增加你的伤害到9（以后可以用5个血石升级1点伤害，按+键升级。）\n";
	cout << "n.无尽手套，20个血石，20个皮革，20个铁锭，刷新这个世界的建筑物。（建筑物位置不会改变，但每一次轮回所有敌对生物攻击+5，血量+15。）\n";
	cout << " Fire:" << fire << "/100 Hungry:" << hungry << "/100" << " Thirsty:" << thirsty << "/150" << " tired:" << tired << "/200" << " hp:" << hp << "/25" << endl;
	cout << "浆果:" << berry << ' ' << "面包：" << bread << ' ' << "水：" << water << " 草药：" << herb << '\n' << "木头：" << wood << ' ' << "石头：" << stone << ' ' << "铁：" << iron << "血石：" << bleed << "皮革：" << leather << endl;
	char op = getch();
	if (op == '1') {
		if (wood >= 5 && stone >= 5) {
			if (level[1] || level[2]) cout << "你已经不需要这个东西了。\n";
			else {
				wood -= 5;
				stone -= 5;
				level[1] = 1;
				fire_lx = 2;
			}
		} else cout << "材料不足！\n";
	}
	if (op == '2') {
		if (iron >= 15) {
			if (level[2]) cout << "你已经不需要这个东西了。\n";
			else {
				iron -= 15;
				level[2] = 1;
				fire_lx = 3;
			}
		} else cout << "材料不足！\n";
	}
	if (op == '3') {
		if (wood >= 5 && stone >= 1) {
			if (level[3] || level[4] || level[5]) cout << "你已经不需要这个东西了。\n";
			else {
				wood -= 5;
				stone --;
				level[3] = 1;
				gj = 3;
			}
		} else cout << "材料不足！\n";
	}
	if (op == '4') {
		if (stone >= 5 && wood >= 1)  {
			if (level[4] || level[5]) cout << "你已经不需要这个东西了。\n";
			else {
				stone -= 5;
				wood--;
				level[4] = 1;
				gj = 5;
			}
		} else cout << "材料不足！\n";
	}
	if (op == '5') {
		if (iron >= 5 && wood >= 2 && stone >= 2)  {
			if (level[5]) cout << "你已经不需要这个东西了。\n";
			else {
				stone -= 2;
				wood -= 2;
				iron -= 2;
				level[5] = 1;
				gj = 7;
			}
		} else cout << "材料不足！\n";
	}
	if (op == '6') {
		if (herb >= 5 && berry >= 5)  {
			herb -= 5;
			berry -= 5;
			high_herb++;
		} else cout << "材料不足！\n";
	}
	if (op == '7') {
		if (wood >= 10)  {
			if (level[7] || level[8]) cout << "你已经不需要这个东西了。\n";
			else {
				wood -= 10;
				level[7] = 1;
				low_hp = 2;
			}
		} else cout << "材料不足！\n";
	}
	if (op == '8') {
		if (iron >= 10)  {
			if (level[8]) cout << "你已经不需要这个东西了。\n";
			else {
				iron -= 10;
				level[8] = 1;
				low_hp = 5;
			}
		} else cout << "材料不足！\n";
	}
	if (op == '9') {
		if (iron >= 70 && stone >= 20 && wood >= 20) {
			iron -= 70;
			stone -= 20;
			wood -= 20;
			kill++;
		} else cout << "材料不足！\n";
	}
	if (op == '0') {
		if (iron >= 20 && wood >= 20 && stone >= 20) {
			iron -= 20;
			wood -= 20;
			stone -= 20;
			quick_move++;
		} else cout << "材料不足！\n";
	}
	if (op == 'o') {
		if (wood) {
			wood--;
			fire += 20;
			fire = min(fire, 100);
		} else cout << "材料不足！\n";
	}
	if (op == 'p') {
		if (berry >= 2) {
			herb++;
			berry -= 2;
		} else cout << "材料不足！\n";
	}
	if (op == 'l') {
		if (bleed >= 5 && leather >= 3) max_hp += 3, bleed -= 5, leather -= 3;
		else cout << "材料不足！\n";
	}
	if (op == 'm') {
		if (level[5] && bleed >= 5) {
			level[14] = 1;
			bleed -= 5;
			gj = 9;
		} else cout << "你没有足够的材料。\n";
	}
	if (op == 'n') {
		if (bleed >= 20 && leather >= 20 && iron >= 20) {
			bleed -= 20, leather -= 20, iron -= 20;
			cout << "正在重置。\n";
			Sleep(1000);
			cout << "世界已更新。\n";
			memset(vis, 0, sizeof vis);
			lh++;
		} else cout << "你没有足够的材料。\n";
	}
	press;
}
void temple(int p, int q) {
	if (vis[p][q]) cout << "祭坛的血色已经消失，上面还残留着战斗的痕迹。\n";
	else {
		system("cls");
		system("color 04");
		vis[p][q] = 1;
		cout << "血月生起了。。。\n";
		press;
		cout << "一个法师从沉睡中醒来。。。\n";
		press;
		int x = 100, y = 100 + lh * 15;
		while (1) {
			x = rand() % 15 + 1 * 15 + lh * 5;
			if (y <= 0) {
				int iro = rand() % 10 + 10, blo = rand() % 10 + 10, lea = rand() % 10 + 10;
				cout << "法师倒下了。。。你从他的身上搜到了" << iro << "块铁锭，" << blo << "个血石，" << lea << "片皮革。\n";
				bleed += blo;
				iron += iro;
				leather += lea;
				return ;
			}
			if (hp <= 0) {
				cout << "你倒下了。。。\n";
				exit(0);
			}
			cout << "你选择：1.攻击它；2.秒了\n";
			cout << "你的血量：" << hp << ' ' << "它的血量：" << y << endl;
			char op = getch();
			if (op == '1') {
				int fg1 = rand() % 3, fg2 = rand() % 3;
				cout << "你造成了" << max(gj - fg1, 0) << "点伤害。\n";
				press;
				y -= max(gj - fg1, 0);
				cout << "它对你造成了" << max(x - fg2 - low_hp, 0) << "点伤害。\n";
				press;
				hp -= max(x - fg2 - low_hp, 0);
				system("cls");
			} else if (op == '2') {
				if (kill) {
					kill--;
					y = -0x3f3f3f3f;
				} else {
					cout << "你没有足够多的秒人斧。\n";
				}
			} else if (op == 'c') {
				if (herb) {
					herb--;
					hp += 3;
					hp = min(hp, 25);
				} else {
					cout << "你没有足够多草药。\n";
					press;
				}
			} else if (op == 'x') {
				if (high_herb) {
					high_herb--;
					hp = 25;
				} else cout << "你没有足够的强力生命药水。\n";
			}
			system("cls");
		}
	}
}
int main() {
	system("color 0E");
	cout << "请先看完规则！\n";
	press;
	system("cls");
	cout << "wasd移动，r吃浆果，f吃面包，v喝水，c回复生命，x大量回复，q在野外睡觉，e打开工作台，地图是1000*1000，\nH是房子，进去之后会有5种增益效果。\nG是草丛，有40%概率会有猛兽，当草丛没有猛兽后会有0~4个浆果、和0~4个木头和1~5个草药。\nK是矿洞，有40%会有强盗，当矿洞没有强盗后会有0~6个石头和0~6个铁。\n";
	cout << "O是洞穴，洞穴里会有猛兽，当洞穴没有猛兽后会有1~5瓶水和0~4个石头。\n";
	cout << "在房子周围消耗减半。\n@是坏土，坏土中间会生成一个祭坛，祭坛周围哈曼顿距离10格会生成坏土，中间有亡灵法师，血量100，攻击15~30，击败后会掉落10~20个血石，10~20个铁锭和10~20个皮革。\n";
	cout << "人有4种死亡方式：\n战死，用草药回复生命，回复3点，生命上限是25点，一开始有25点，生命值归0就会死；\n饿死，用浆果和面包降低饥饿值，分别降低10点（浆果还可以额外降低10点口渴值）和40点，饥饿值到100点会死；\n渴死，用水降低口渴值，一次降低20点，口渴值到150会渴死；\n累死，只能在房子休息或野外按q休息，休息后劳累值会归0，在野外休息只会-20，劳累值200点会累死。\n";
	press;
	system("cls");
	srand(time(0));
	for (int i = 1; i <= 1000; i++)
		for (int j = 1; j <= 1000; j++)
			mp[i][j] = '.';
	init_map();
	int x = N / 2, y = N / 2;
	int d;
	put(x, y);
	while (1) {
		char op = getch();
		if (op == 'w' || op == 'a' || op == 's' || op == 'd') {
			if (op == 'w') {
				if (!check(x - 1, y)) {
					if (mp[x - 1][y] == 'L') hungry++, tired++, thirsty++, fire = max(0, fire - 1);
					else fire = max(0, fire - 2), hungry += 2, tired += 2, thirsty += 2;
					x--, d = 'W';
				} else {
					if (mp[x - 1][y] == 'H') home(x - 1, y);
					if (mp[x - 1][y] == 'G') grass(x - 1, y);
					if (mp[x - 1][y] == 'O') hole(x - 1, y);
					if (mp[x - 1][y] == 'K') mine(x - 1, y);
					if (mp[x - 1][y] == 'T') temple(x - 1, y);
					x--;
				}
			} else if (op == 'a') {
				if (!check(x, y - 1)) {
					if (mp[x][y - 1] == 'L') hungry++, tired++, thirsty++, fire = max(0, fire - 1);
					else fire = max(0, fire - 2), hungry += 2, tired += 2, thirsty += 2;
					y--, d = 'A';
				} else {
					if (mp[x][y - 1] == 'H') home(x, y - 1);
					if (mp[x][y - 1] == 'G') grass(x, y - 1);
					if (mp[x][y - 1] == 'O') hole(x, y - 1);
					if (mp[x][y - 1] == 'K') mine(x, y - 1);
					if (mp[x][y - 1] == 'T') temple(x, y - 1);
					y--;
				}
			} else if (op == 's') {
				if (!check(x + 1, y)) {
					if (mp[x + 1][y] == 'L') hungry++, tired++, thirsty++, fire = max(0, fire - 1);
					else fire = max(0, fire - 2), hungry += 2, tired += 2, thirsty += 2;
					x++, d = 'S';
				} else {
					if (mp[x + 1][y] == 'H') home(x + 1, y);
					if (mp[x + 1][y] == 'G') grass(x + 1, y);
					if (mp[x + 1][y] == 'O') hole(x + 1, y);
					if (mp[x + 1][y] == 'K') mine(x + 1, y);
					if (mp[x + 1][y] == 'T') temple(x + 1, y);
					x++;
				}
			} else if (op == 'd') {
				if (!check(x, y + 1)) {
					if (mp[x][y + 1] == 'L') hungry++, tired++, thirsty++, fire = max(0, fire - 1);
					else fire = max(0, fire - 2), hungry += 2, tired += 2, thirsty += 2;
					y++, d = 'D';
				} else {
					if (mp[x][y + 1] == 'H') home(x, y + 1);
					if (mp[x][y + 1] == 'G') grass(x, y + 1);
					if (mp[x][y + 1] == 'O') hole(x, y + 1);
					if (mp[x][y + 1] == 'K') mine(x, y + 1);
					if (mp[x][y + 1] == 'T') temple(x, y + 1);
					y++;
				}
			}
		}
		if (op == 'r') {
			if (berry) {
				berry--;
				hungry -= 10;
				thirsty -= 10;
				hungry = max(hungry, 0);
				thirsty = max(thirsty, 0);
			} else {
				cout << "你没有足够多浆果。\n";
				press;
			}
		}
		if (op == 'f') {
			if (bread) {
				bread--;
				hungry -= 40;
				hungry = max(hungry, 0);
			} else {
				cout << "你没有足够多面包。\n";
				press;
			}
		}
		if (op == 'v') {
			if (water) {
				water--;
				thirsty -= 20;
				thirsty = max(thirsty, 0);
			} else {
				cout << "你没有足够多水。\n";
				press;
			}
		}
		if (op == 'c') {
			if (herb) {
				herb--;
				hp += 3;
				hp = min(hp, max_hp);
			} else {
				cout << "你没有足够多草药。\n";
				press;
			}
		}
		if (op == 'e') {
			made();
		}
		if (op == 'q') {
			int x = rand() % 4;
			cout << "z";
			Sleep(1000);
			cout << "z";
			Sleep(1000);
			cout << "z\n";
			system("cls");
			if (x == 2) {
				cout << "你被噩梦惊醒了，疲倦值增加40。\n";
				tired += 40;
			} else {
				cout << "平安夜。\n";
				tired -= 20;
				tired = max(tired, 0);
			}
			press;
		}
		if (op == 'x') {
			if (high_herb) {
				high_herb--;
				hp = max_hp;
			} else cout << "你没有足够的强力生命药水。\n";
			press;
		}
		if (op == '+') {
			if (level[14]) {
				if (bleed >= 5) {
					bleed -= 5;
					gj++;
					cout << "已增加。\n";
				} else {
					cout << "血石不够。\n";
					press;
				}
			} else {
				cout << "你没有血石。\n";
				press;
			}
		}
		if (hungry >= 100 || thirsty >= 150 || tired >= 200) {
			system("cls");
			cout << "你消失在了茫茫森林中。\n";
			return 0;
		}
		system("cls");
		put(x, y);
	}
}
